import axios from "@/libs/api.request";

//部门
export const getDeptList = () => {
  return axios.request({
    url: "/sys/dept/list",
    method: "get"
  });
};

export const getDeptCascader = () => {
  return axios.request({
    url: "/sys/dept/cascader",
    method: "get"
  });
};

export const saveDept = data => {
  return axios.request({
    data: data,
    url: "/sys/dept/save",
    method: "post",
    headerType: "json"
  });
};
export const updateDept = data => {
  return axios.request({
    data: data,
    url: "/sys/dept/update",
    method: "post",
    headerType: "json"
  });
};

export const delDept = data => {
  return axios.request({
    data: data,
    url: "/sys/dept/delete",
    method: "post",
    headerType: "json"
  });
};

//角色
export const getRoleSelect = () => {
  return axios.request({
    url: "/sys/role/select",
    method: "get"
  });
};

export const getRoleList = data => {
  return axios.request({
    params: data,
    url: "/sys/role/list",
    method: "get"
  });
};

export const getRoleInfo = data => {
  return axios.request({
    url: "/sys/role/info/" + data.toString(),
    method: "get"
  });
};

export const saveRole = data => {
  return axios.request({
    data: data,
    url: "/sys/role/save",
    method: "post",
    headerType: "json"
  });
};

export const updateRole = data => {
  return axios.request({
    data: data,
    url: "/sys/role/update",
    method: "post",
    headerType: "json"
  });
};

export const delRole = data => {
  return axios.request({
    data: data,
    url: "/sys/role/delete",
    method: "post",
    headerType: "json"
  });
};

//用户
export const getUserList = data => {
  return axios.request({
    params: data,
    url: "/sys/user/list",
    method: "get"
  });
};

export const getUserInfo = data => {
  return axios.request({
    url: "/sys/user/info/" + data.toString(),
    method: "get"
  });
};

export const updateUser = data => {
  return axios.request({
    data: data,
    url: "/sys/user/update",
    method: "post",
    headerType: "json"
  });
};

export const saveUser = data => {
  return axios.request({
    data: data,
    url: "/sys/user/save",
    method: "post",
    headerType: "json"
  });
};

export const delUser = data => {
  return axios.request({
    data: data,
    url: "/sys/user/delete",
    method: "post",
    headerType: "json"
  });
};

export const modifyPwd = data => {
  return axios.request({
    data: data,
    url: "/sys/user/password",
    method: "post",
    headerType: "json"
  });
};

export const resetPwd = data => {
  return axios.request({
    data: data,
    url: "/sys/user/resetpwd",
    method: "post"
  });
};

//菜单
export const getMenuList = data => {
  return axios.request({
    params: data,
    url: "/sys/menu/list1",
    method: "get"
  });
};

export const getMenuListAll = data => {
  return axios.request({
    params: data,
    url: "/sys/menu/list",
    method: "get"
  });
};


export const getMenuNav = () => {
  return axios.request({
    url: "/sys/menu/nav",
    method: "get"
  });
};

export const getMenuCascader = () => {
  return axios.request({
    url: "/sys/menu/cascader",
    method: "get"
  });
};

export const saveMenu = data => {
  return axios.request({
    data: data,
    url: "/sys/menu/save",
    method: "post",
    headerType: "json"
  });
};

export const updateMenu = data => {
  return axios.request({
    data: data,
    url: "/sys/menu/update",
    method: "post",
    headerType: "json"
  });
};

export const delMenu = data => {
  return axios.request({
    data: data,
    url: "/sys/menu/delete",
    method: "post"
  });
};
//日志
export const getLogList = data => {
  return axios.request({
    params: data,
    url: "/sys/log/list",
    method: "get"
  });
};

//推送管理
export const pushConfigInfo = () => {
  return axios.request({ url: "bss/push/info", method: "get" });
};

export const updateConfigInfo = data => {
  return axios.request({
    data: data,
    url: "/bss/push/update",
    method: "post",
    headerType: "json"
  });
};

//推送模板
export const getConfigList = data => {
  return axios.request({
    params: data,
    url: "/bss/config/list",
    method: "get"
  });
};

export const saveConfig = data => {
  return axios.request({
    data: data,
    url: "/bss/config/save",
    method: "post",
    headerType: "json"
  });
};
export const updateConfig = data => {
  return axios.request({
    data: data,
    url: "/bss/config/update",
    method: "post",
    headerType: "json"
  });
};
export const deleteConfig = data => {
  return axios.request({
    data: data,
    url: "/bss/config/delete",
    method: "post"
  });
};
export const configCombo = data => {
  return axios.request({
    params: data,
    url: "/bss/config/combo",
    method: "get"
  });
};

//定时任务
export const getScheduleList = data => {
  return axios.request({
    params: data,
    url: "/sys/schedule/list",
    method: "get"
  });
};

export const saveSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/save",
    method: "post",
    headerType: "json"
  });
};
export const updateSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/update",
    method: "post",
    headerType: "json"
  });
};
export const deleteSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/delete",
    method: "post",
    headerType: "json"
  });
};
export const pauseSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/pause",
    method: "post",
    headerType: "json"
  });
};
export const resumeSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/resume",
    method: "post",
    headerType: "json"
  });
};
export const runSchedule = data => {
  return axios.request({
    data: data,
    url: "/sys/schedule/run",
    method: "post",
    headerType: "json"
  });
};